#define F_CPU 11059200  	                 //11.0592MHz processor 250nS
						 //CPU Clock Speed

#define CYCLES_PER_US	((F_CPU+500000)/1000000) //cpu cycles per microsecond

/*********************************************************************************************/
/* Delay function               						             */
/*********************************************************************************************/
void delay_us(unsigned int us)
{
	unsigned int delay_loops;
	unsigned int i;

	delay_loops = (us+3)/5*CYCLES_PER_US;	// +3 for rounding up
	for (i = 0; i < delay_loops; i++);	// one loop takes 5 cpu cycles
	
}

void delay_ms(unsigned int d_cnt)
{
        unsigned int i;
	for (i = 0; i < d_cnt; i++)
	delay_us(1000);				// 1000us => 1ms
}
